<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/tentime">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
<div class="layui-form tentime-compile">
    <form id="inputForm" th:object="${entity}" class="layui-form">
        <input id="id" type="hidden" name="id" th:if="${entity}" th:value="${entity?.id}"/>
        <div class="layui-form-item">
	        <div class="layui-inline">
	            <label class="layui-form-label required">客户类型</label>
	            <div class="layui-input-inline">
	                <select name="type" mo:dict="CUSTOMER_TYPE" mo-selected="${entity?.type}" mo-empty="" lay-verify="type|required"></select>
	            </div>
	        </div>
            <div class="layui-inline">
                <label class="layui-form-label required">客户名称</label>
                <div class="layui-input-inline">
                    <input class="layui-input" lay-verify="required" type="text" name="name" placeholder="请输入客户名称" th:value="${entity?.name}">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
	            <label class="layui-form-label required">手机号码</label>
	            <div class="layui-input-inline">
	                <input class="layui-input" lay-verify="required" type="text" name="mobile" placeholder="请输入手机" th:value="${entity?.mobile}">
	            </div>
            </div>
            <div class="layui-inline">
	            <label class="layui-form-label">联系电话</label>
	            <div class="layui-input-inline">
	                <input class="layui-input" type="text" name="tel" placeholder="请输入联系方式" th:value="${entity?.tel}">
	            </div>
            </div>
        </div>
        <div class="layui-form-item">
        	<div class="layui-inline">
	        	<label class="layui-form-label">地址</label>
	            <div class="layui-input-inline">
	                <input class="layui-input url-input" type="text" name="address"  placeholder="请输入地址" th:value="${entity?.address}" style="width: 360px!important;">
	            </div>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <textarea placeholder="请输入内容" class="layui-textarea" name="remarks" style="width:450px;">[[${entity?.remarks}]]</textarea>
            </div>
        </div>
        <div class="layui-form-item tentime-finally">
            <button class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="submit_button" shiro:hasAnyPermissions="cars:customer:add,cars:customer:edit"><i class="fa fa-check-circle"></i> 保存</button>
            <button class="layui-btn layui-btn-sm layui-btn-primary" onclick="closeWin();" type="button"><i class="fa fa-times-circle"></i> 关闭</button>
        </div>
    </form>
</div>
<script th:replace="/common/template :: common"></script>
<script type="text/javascript" th:inline="javascript">
    layui.use(['form','layer'], function () {
        window.form = layui.form;
        layer = layui.layer;
        form.on("submit(submit_button)", function (data) {
	        $("#inputForm").ajaxSubmit({
				type : "post"
	            ,url : ctx + '/cars/customer/saveEntity'
	            ,success : function(data) {
	            	var code = data.code;
	            	if (code == 200) {
	            		parent.layer.msg('数据保存成功!', {icon: 1});
	            		closeWin();
	            		window.parent.reloadTable();
	            	} else {
	            		parent.layer.msg('数据验证失败!', {icon: 2});
	            	}
	            }
			});
       		return false;
       	});
    });

</script>
</body>
</html>